﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyDoiXe.Lop_du_lieu;

namespace QuanLyDoiXe.lop_doi_tuong
{
    class lop_bctinhtranggiaohang
    {
        string Mxe,Mhanghoa,Mtrangthai;
        int Thang;
        DateTime Ngaygiao;
        public lop_bctinhtranggiaohang(){}
        public lop_bctinhtranggiaohang(string Mxe, string Mhanghoa,string Mtrangthai,int Thang, DateTime Ngaygiao)
        {
            this.Mxe = Mxe;
            this.Mhanghoa = Mhanghoa;
            this.Mtrangthai = Mtrangthai;
            this.Thang = Thang;
            this.Ngaygiao = Ngaygiao;
        }
        #region Các phương thức hoạt động
        public bool taomoi()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("insert into baocaotinhtranggiaohang values ('" + Mxe + "','" + Mhanghoa + "','" + Mtrangthai + "',,'" + Thang + "','" + Ngaygiao + "')") == 1)
            {
               lop_ket_noi.huyketnoi();
               return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        public bool capnhat()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("update baocaotinhtranggiaohang set Mhanghoa='" + Mhanghoa + "',Mtrangthai='" + Mtrangthai + "',Thang='" + Thang + "',Ngaygiao='" + Ngaygiao + "' where Mxe='" + Mxe + "'") == 1)
            {
                lop_ket_noi.huyketnoi();
                return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        public bool xoa()
        {
            Lop_lay_du_lieu dl = new Lop_lay_du_lieu();
            if (dl.thucthitruyvan("delete from baocaotinhtranggiaohang where Mxe='" + Mxe + "'") == 1)
            {
                lop_ket_noi.huyketnoi();
                return true;
            }
            else
            {
                lop_ket_noi.huyketnoi();
                return false;
            }
        }
        #endregion
    }
}
